// Copyright 2008 and onwards Matt Burkhart, Mike Chan.
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.

#ifndef SOURCE_H
#define SOURCE_H

#include <string>

// A Source is a location from the root file system that files can be stored.
class Source {
public:
  Source(const std::string& location);

  unsigned long long GetFreeSpace() const;

  // The equals operator acts on the exact source location, regardless of the
  // physical device this location resides on.
  bool operator==(const Source& operand) const;

  // The less than operator dictates allocation priority. A source which has the
  // property of being "less than" another source will have files allocated to
  // it first.
  bool operator<(const Source& operand) const;

  // The location of this source as a string type.
  operator const std::string&() const;
  operator const char*() const;

private:
  std::string location_;
};

struct SourceComparitor {
  bool operator ()(const Source* source_a, const Source* source_b) const {
    return *source_a < *source_b;
  }
};

#endif // SOURCE_H
